{% extends 'base/base1.html' %}

{% block title %}个人中心{% endblock %}

{% block css %}
<style>
.profile-container {
    max-width: 800px;
    margin: 0 auto;
    padding: 20px;
}

.profile-card {
    background: white;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

.profile-header {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    padding: 40px 30px;
    text-align: center;
}

.avatar {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    border: 4px solid white;
    object-fit: cover;
    margin-bottom: 20px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

.profile-name {
    font-size: 1.8rem;
    font-weight: 600;
    margin-bottom: 5px;
}

.profile-role {
    opacity: 0.9;
    font-size: 1rem;
}

.profile-body {
    padding: 30px;
}

.info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.info-item {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 10px;
    border-left: 4px solid #667eea;
}

.info-label {
    font-size: 0.9rem;
    color: #6c757d;
    margin-bottom: 5px;
    font-weight: 500;
}

.info-value {
    font-size: 1.1rem;
    color: #2c3e50;
    font-weight: 600;
}

.action-buttons {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
}

.btn-action {
    flex: 1;
    min-width: 150px;
    padding: 12px 20px;
    border: none;
    border-radius: 8px;
    font-weight: 500;
    text-decoration: none;
    text-align: center;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
}

.btn-secondary {
    background: #6c757d;
    color: white;
}

.btn-warning {
    background: #ffc107;
    color: #212529;
}

.btn-action:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
    text-decoration: none;
    color: inherit;
}
</style>
{% endblock %}

{% block main %}
<div class="profile-container">
    <div class="profile-card">
        <div class="profile-header">
            {% if request.user.header %}
                <img src="{{ request.user.header.url }}" alt="用户头像" class="avatar">
            {% else %}
                <img src="/media/head/head.png" alt="默认头像" class="avatar">
            {% endif %}
            <div class="profile-name">{{ request.user.username }}</div>
            <div class="profile-role">系统管理员</div>
        </div>
        
        <div class="profile-body">
            <div class="info-grid">
                <div class="info-item">
                    <div class="info-label">用户名</div>
                    <div class="info-value">{{ request.user.username }}</div>
                </div>
                
                <div class="info-item">
                    <div class="info-label">注册时间</div>
                    <div class="info-value">{{ request.user.date_joined|date:"Y-m-d H:i" }}</div>
                </div>
                
                <div class="info-item">
                    <div class="info-label">上次登录</div>
                    <div class="info-value">
                        {% if request.user.last_login %}
                            {{ request.user.last_login|date:"Y-m-d H:i" }}
                        {% else %}
                            未知
                        {% endif %}
                    </div>
                </div>
                
                <div class="info-item">
                    <div class="info-label">账户状态</div>
                    <div class="info-value">
                        {% if request.user.is_active %}
                            <span style="color: #28a745;">正常</span>
                        {% else %}
                            <span style="color: #dc3545;">已禁用</span>
                        {% endif %}
                    </div>
                </div>
            </div>
            
            <div class="action-buttons">
                <a href="{% url 'user:changeinfo' %}" class="btn-action btn-primary">
                    <i class="fas fa-edit"></i> 修改信息
                </a>
                <a href="{% url 'user:changehead' %}" class="btn-action btn-secondary">
                    <i class="fas fa-camera"></i> 修改头像
                </a>
                <a href="{% url 'user:changepwd' %}" class="btn-action btn-warning">
                    <i class="fas fa-key"></i> 修改密码
                </a>
            </div>
        </div>
    </div>
</div>
{% endblock %}